<template>
  <div id="app">
    <choose-item v-for="(item,index) in list" :key="index" :item="item" @chooseFn="change"></choose-item>
  </div>
</template>

<script>
import chooseItem from './components/chooseItem';
import axios from 'axios';

export default {
  name: 'App',
  data(){
    return {
      list:[],
      getTypeofFlollwer:{}
    }
  },
  components:{
    chooseItem
  },
  created(){
    axios.get('/api/list').then((res) => {
      if(res.data.code == "1"){
        this.list = res.data.data;
        this.list.forEach(item => {
          this.$set(this.getTypeofFlollwer,item.Subject,item.Content[0].Type)
        })
      }
    }).catch((err) => {
      console.warn(err)
    })
  },
  methods:{
    change(Subject,type){
      this.getTypeofFlollwer[Subject] = type;
      console.log(this.getTypeofFlollwer)
    }
  }
}
</script>

<style>
*{
  margin:0;
  padding: 0;
}
#app{
  width: 100%;
  height: 100%;
  overflow: scroll;
}
ul>li{
  list-style: none
}
body,html{
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0 10px;
  box-sizing: border-box;
}
</style>
